package com.lepan.ovgms.manages;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

public abstract class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    protected Context mContext;
    protected List datas = new ArrayList();
    private BaseFragment onRecyclerViewListener;
    private View itemApply;
    private RecyclerView.ViewHolder mViewHolder;

    public MyAdapter(Context ctx) {
        mContext = ctx;
    }

    public abstract RecyclerView.ViewHolder inflaterItem();


    public void setDatas(List<Object> datas) {
        //this.datas.clear();
        this.datas.addAll(datas);
        Log.e("XXXX", "setDatas: " + this.datas.size());
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return inflaterItem();
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
    }

    @Override
    public int getItemCount() {
        return datas.size();
    }

    public void setOnRecyclerViewListener(BaseFragment onRecyclerViewListener) {
        this.onRecyclerViewListener = onRecyclerViewListener;
    }
}

